
<template>
  <div class="chat-item-container">
    <div v-if="message.role === 'user'" class="user-content">
      <span class="user-message"> {{message.content}}</span>
    </div>
    <div v-if="message.role === 'koala'" class="koala-content">
      <div class="kola-left">
        <div class="logo-container">
          <img style="transform: scale(0.8);object-fit: contain"  src="@/assets/logo/chat-logo.png" alt="">
        </div>
      </div>
      <div class="kola-right">
        <span>
           {{message.content}}
      </span>
      </div>

    </div>
    <div :style="{justifyContent: message.role === 'user' ? 'flex-end' : 'flex-start'}" class="chat-item-operate">
      <span style="cursor: pointer">
        <t-tooltip
            content="复制"
            placement="right"
            show-arrow
        >
          <FileCopyIcon style="font-size: 18px" />
        </t-tooltip>

      </span>
    </div>
  </div>
</template>

<script setup>
import {FileCopyIcon, ModeDarkIcon} from "tdesign-icons-vue-next";

const props = defineProps({'message' : Object})
const message = props.message

</script>

<style scoped>
.logo-container {
  display: flex;
  border-radius: 50%;
  border: 1px solid rgb(89, 92, 103);
  height: 40px;
  width: 40px;

  background-color: var(--chat-item-background);
  position: relative;
  top: -10px;
}
.koala-content {
  width: 100%;
  display: flex;
}
.kola-right {
  width: 92%;
}
.kola-left {
  width: 8%;
  min-width: 8%;
}
.chat-item-operate {
  display: flex;
  height: 30px;
  align-items: center;
  opacity: 0;
  transition: 0.3s;
}

.user-message {
  display: flex;
  align-self: flex-end;
  padding: 10px;
  background-color: var(--chat-item-background);
  border-radius: 5px;
  max-width: 92%;
  white-space: normal;
  word-break: break-word;
}

.chat-item-container:hover .chat-item-operate{
  opacity: 1;
}
.user-content {
  display: flex;
  justify-content: flex-end;
  flex-direction: column;
}

.chat-item-container {
  width: 100%;
  color: var(--color);
  font-size: 16px;
}

</style>
